package com.example.leetcode;

import java.util.*;
import java.util.stream.Collectors;

public class Main88 {
    public static void main(String[] args) {
        String[] strs = {};

        List<Integer> height = Arrays.stream(strs)
                .map(Integer::parseInt)
                .collect(Collectors.toList());

        //Scanner scanner = new Scanner(System.in);
        Integer num = 8;
        String[] strings = {"123","124","125","121","119","122","126","123"};
        List<Integer> ww= Arrays.stream(strings).map(Integer::parseInt).collect(Collectors.toList());
        List<Integer> w=ww.stream().sorted().collect(Collectors.toList());
        //假设有一个Student对象（拥有四个属性：编码：pId,姓名：pName，语文分数:pChinese，数学分数:pMath）
        ArrayList<Integer> sumAmountResult = new ArrayList<Integer>();
        ww.stream().mapToInt(Integer::intValue).sum();
     //   Integer maxValue = list.stream().reduce(Integer::max).get();
        Integer minValue  = ww.stream().reduce(Integer::sum).get();
      //  list.stream().distinct().count();
        ww.stream().mapToInt(Integer::intValue).min();
        ww.stream().mapToInt(Integer::intValue).average();

        System.out.println(minValue);
       // scanner.close();
        LinkedList<Integer> index= new LinkedList<>();
        for (int i=0;i<num;i++){
            int n = Integer.valueOf(strings[i]);
            int pos=0;
            for (int j=i+1;j<num;j++){
                Integer m = Integer.valueOf(strings[j]);
                if (m>n){
                    pos=j;
                    break;
                }
            }
            index.add(pos);
        }
        StringBuffer sb= new StringBuffer();
        for (Integer i:index){
            sb.append(i).append(" ");
        }
        System.out.println(sb.toString());
    }
}
